<form class="form-inline" method="get">

   

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="un_condition" value="{$un_condition}"
                   placeholder="联盟商名称|联盟商ID">
        </div>
    </div>
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="condition" value="{$condition}"
                   placeholder="卡券标题">
        </div>
    </div>
    <div class="form-group col-xs-2">
        <button type="submit" class="btn btn-success">
            搜索
        </button>

        <button type="button" class="btn btn-primary" onclick="modal('{:url(\'addDiscount')}','添加卡券')">
            添加卡券
        </button>
    </div>
</form>

<hr>

<table class="table table-striped">
    <thead>
    <tr>
        <td>ID</td>
        <td>联盟商</td>
        <td>标题</td>
        <td>背景色</td>
        <td>折扣</td>
        <td>显示</td>
        <td>排序</td>
        <td>编辑时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>

        <td>
            <label class="label label-default">
                {$item.union_name}【ID：{$item.union_id}】
            </label>
        </td>
        <td>{$item.title}</td>
        <td>
            <span style="display: inline-block;width:55px;height: 55px;background:#{$item.thumb}"></span>
        </td>
        <td>
            <label class="label label-danger">{$item.discount}%</label>
        </td>
        <td>
            {if condition="$item.is_visible == 1"}
            显示
            {else/}
            隐藏
            {/if}
        </td>

        <td>{$item.display_order}</td>
        <td>{$item.update_time|show_datetime}</td>
        <td>
            <div class="btn-group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    操作
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li>
                        <a href="javascript:void(0)" onclick="modal('{:url(\'editDiscount\',array(\'id\'=>$item[\'id\']))}', '编辑卡券')">
                            编辑
                        </a>
                    </li>

                    <li>
                        <a href="javascript:void(0)" data-toggle="confirm"
                           data-title="删除卡券"
                           data-content="确认删除卡券？请谨慎操作"
                           data-url="{:url('delDiscount',array('id'=>$item['id']))}">
                            删除卡券
                        </a>
                    </li>

                    <li role="separator" class="divider"></li>
                </ul>
            </div>
        </td>

    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>

<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {

        //获取分类
        $("#category-selector").select2({
            placeholder: "选择联盟商分类",
            allowClear: true
        });
    });
</script>